package cn.tedu.homeworkivos.user.controller;

import cn.tedu.homeworkivos.base.response.JsonResult;
import cn.tedu.homeworkivos.user.pojo.dto.LoginParam;
import cn.tedu.homeworkivos.user.pojo.vo.UserLoginVO;
import cn.tedu.homeworkivos.user.service.UserService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/v1/user")
@Tag(name="用户管理")
@RestController
public class UserController {
    @Autowired
    UserService service;
    @Operation(summary = "登录")
    @ApiOperationSupport(order = 10)
    @PostMapping("/login")
    public JsonResult login(@Validated @RequestBody LoginParam param)
    {
        log.debug("用户登录，参数={}",param);
        UserLoginVO uvo=service.login(param);
        return JsonResult.ok(uvo);
    }
}
